package testing;

import hypeerweb.*;

import static org.junit.Assert.*;

import org.junit.Test;

import states.NodeState;

public class NodeStateTest {

	@Test
	public void testGetNodeState() {
		NodeState state = NodeState.StandardNodeState;

		assert (state.STATE_ID == 0);

		state = NodeState.TerminalNodeState;

		assert (state.STATE_ID == 4);

		assert (state.getNodeState() == 4);
	}

	@Test
	public void testAddNode() {
		HyPeerWeb web = HyPeerWeb.getSingleton();
		web.clear();

		Node tnode0 = new Node(0);
		Node tnode1 = new Node(1);
		Node tnode2 = new Node(2);
		Node tnode3 = new Node(3);

		web.addNode(tnode0);

		assertTrue(web.size() == 1);
		assertTrue(tnode0.getNeighbors().size() == 0);

		web.addNode(tnode1);

		assertTrue(web.size() == 2);
		assertTrue(web.getNode(0).getNeighbors().size() == 1);
		// assertTrue(web.getNode(0).getNeighbors().get(0) == tnode1);

	}
}
